package com.blue.fish.tiny.parser.util;

import com.blue.fish.tiny.lexer.Token;

/**
 * @author QingFan
 * @version 1.0.0
 * @date 2023年01月31日 20:56
 */
public class ParseException extends Exception {

    private static final long serialVersionUID = -7347891424218712428L;

    private final String _msg;

    public ParseException(String msg) {
        this._msg = msg;
    }

    public ParseException(Token token) {
        _msg = String.format("Syntax Error, unexpected token %s", token.getValue());
    }

    @Override
    public String getMessage() {
        return _msg;
    }
}
